package demo.d2;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;

public class ServiceFacetry {
    public static <T> T getInstace(Class interClass) {
        return (T) Proxy.newProxyInstance(interClass.getClassLoader(), new Class[]{interClass}, new InvocationHandler() {
            @Override
            public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
                System.out.println("success:"+method.getName());
                return "abc";
            }
        });
    }

}
